home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / machack / Hacks96 / FlyPaper.sit / Fly Paper / FlyPaper Source / New Sources / ClippingFile.h < prev    next >
Text File  |  1996-06-22  |  2KB  |  90 lines

  1. #ifndef CLIPPINGFILE_H
  2. #define CLIPPINGFILE_H
  3.  
  4. #ifndef FLYPAPERAPP_H
  5. #include "FlyPaperApp.h"
  6. #endif
  7.  
  8. #ifndef __DRAG__
  9. #include <Drag.h>
  10. #endif
  11.  
  12. #define                kMyClippingType                'FlyD'
  13. #define                kTextClippingType            'clpt'
  14. #define                kSoundClippingType            'clps'
  15. #define                kPictureClippingType        'clpp'
  16.  
  17. #define                kFinderClippingSignature    'drag'
  18. #define                kMyClippingSignature        kSignature
  19.  
  20. #define                kClippingTOCResType            'drag'
  21. #define                kClippingTOCResID            128
  22. #define                kFlavorResID                256
  23.  
  24. class CThumbnail;
  25. class CClippingFileData;
  26.  
  27. class CClippingFile
  28. {
  29. public:
  30.                             CClippingFile (FSSpec& fileOnDisk);
  31.                             CClippingFile (short refNum);
  32.                             ~CClippingFile ();
  33.     static CClippingFile*    NewClippingFileFromDragItem (DragReference dragRef, 
  34.                                     ItemReference itemRef, Point dropPoint, short tile);
  35.     
  36. protected:
  37.     static CClippingFile*    NewClippingFile (FSSpec& fileLocation, OSType primaryFlavor = '????');
  38.     void                    InitCClippingFile ();
  39.  
  40. public:
  41.     void                    AddFlavor (const FlavorType flavorType, const Handle flavorData);
  42.     void                    AddThumbnail (CThumbnail& thumbnail);
  43.     CThumbnail*                GetThumbnail ();
  44.  
  45.     short                    CountFlavors ();
  46.     void                    GetIndFlavor (short index, FlavorType& gotFlavor, Handle& gotHandle);
  47.     void                    GetIndFlavorType (short index, FlavorType& gotFlavor);
  48.     
  49.     DragReference            BuildDragReference ();
  50.     CClippingFileData*        GetData () { return fData; }
  51.     Boolean                    GetFSSpec (FSSpec& spec);
  52.     
  53. protected:
  54.  
  55. #if PRAGMA_ALIGN_SUPPORTED
  56. #pragma options align=mac68k
  57. #endif
  58.  
  59.     // ClippingFlavor -- each flavor in the ClippingTOC is represented by this data structure.  This
  60.     // is a best-guess interpretation of the Finder's clipping file format.
  61.     
  62.     typedef struct {
  63.         FlavorType                flavorType;
  64.         unsigned long            reserved1;
  65.         unsigned long            reserved2;
  66.         unsigned long            reserved3;        
  67.     } ClippingFlavorRec;
  68.  
  69.     // ClippingTOC -- table of contents for a clipping file.  This is a best-guess interpretation
  70.     // of the Finder's clipping file format.
  71.     typedef struct {
  72.         unsigned long            version;
  73.         unsigned long            reserved1;
  74.         unsigned long            reserved2;
  75.         unsigned short            reserved3;
  76.         unsigned short            flavorCount;
  77.         ClippingFlavorRec        flavors [];
  78.     } ClippingTOCRec, **ClippingTOCHandle;
  79.     
  80.  
  81. #if PRAGMA_ALIGN_SUPPORTED
  82. #pragma options align=reset
  83. #endif
  84.  
  85.     short                    fRefNum;
  86.     ClippingTOCHandle        fClippingTOC;
  87.     CClippingFileData*        fData;
  88. };
  89.  
  90. #endif